import loading from '@/components/xuan-loading/xuan-loading.vue'
import cLabel from "@/components/cat-label/cat-label.vue"
import fromItem from '@/components/from-item/from-item.vue'
import lsjUpload from '@/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue';
import {
	log
} from 'util'
export default {
	props: {
		mustIcon: {
			type: String,
			default: require('@/static/Scope.png'),
		},
		unIcon: {
			type: String,
			default: require('@/static/unscope.png'),
		}
	},
	data() {

		return {
			Inv: 5,


			// 详情
			totalData: {
				lrCheckSample: {
					fSampletypename: "", //样品种类汉字
					fSamplemodel: "", //样品编码
					fSamplereportnostr: "", //报告编号
					fReportdates: "", //报告日期
					fProjectlocation: "", //工程部位/用途
				},
				checkSampletestclose: {
					fId: "", // 申请单fid //为空判断为新增
					fCompanyid: "", // 施工标段id
					fParentid: "", // 对应的超标记录fid
					fWarningcontent: "", // 不合格参数及结果
					fReason: "", // 问题原因
					fHandleway: "", // 处理方式
					fHandleresult: "", // 处理结果
					fHandledate: "",
					fHandledates: "", // 处理日期
					fHandleusername: "", // 处理人名称
					fHandlefile: "", // 附件

					fFirstcheckresult: "", // 一级审核处理结果
					fFirstcheckopinion: "", // 一级审核处理意见
					fFirstcheckusername: "", // 一级审核处理人name
					fFirstcheckdates: "", // 一级审核处理日期
					fFirstcheckfile: "", // 一级审核附件

					fSecondcheckresult: "", // 二级审核处理结果
					fSecondcheckopinion: "", // 二级审核处理意见
					fSecondcheckusername: "", // 二级审核处理人name
					fSecondcheckdates: "", // 二级审核处理日期
					fSecondcheckfile: "", // 二级审核附件

				},
			}, //详情数据

			// 闭合
			must0: "no", //必填
			must1: "no",
			must2: "no",
			// 闭合
			// 详情


			// 文件上传
			count: 8,
			fPhotofilelist: [], //处理过程相关资料
			FauditFileurllist: [], //一级审核材料List
			SauditFileurllist: [], //二级审核材料List
			// 文件上传

			// loading样式
			width: '150rpx',
			height: '100rpx',
			shadeShow: false,
			backgroundColor: "transparent",
			themeColor: '#33CCCC',
			// loading样式



			userInfo: null, //当前登录用户
		};
	},



	onLoad(options) {
		uni.getStorage({
			key: 'userInfo',
			success: function(res) {
				this.userInfo = JSON.parse(res.data);
			}
		});

		this.getFdata(options);
		// || MP-WEIXIN || H5
		// #ifdef APP-PLUS
		// this.playVideo();
		uni.$on('drawer-page', (data) => {
			that.clickNum(data)
		})
		// #endif
		// #ifdef H5
		this.appliance = 1
		// #endif
	},
	onShow() {

	},
	onReady() {},
	components: {
		loading,
		cLabel,
		lsjUpload,
		fromItem
	},

	onUnload() {
		uni.$off('drawer-page')
	},

	methods: {
		// 切换表头
		yj_searchForm(num) {
			var that = this;
			this.Inv = num;
		},
		getFdata(data) {
			this.Fdata = data;
			this.Inv = this.Fdata.Look;
			this.must0 = "no";
			this.must1 = "no";
			this.must2 = "no";
			this.getDetailData(this.Fdata.id, this.Fdata.Look);
		},
		getDetailData(id, num) {
			this.$http.getSampleWorkByFid({
					fId: id
				})
				.then((res) => {
					if (res.errcode == 0) {
						var that = this;
						that.totalData = res.data;
						// 文件
						that.fPhotofilelist = that.totalData.fCloseSourcefileList; //闭合申请单材料List
						this.FauditFileurllist = res.data.fFirstSourcefileList; //一级审核材料List
						this.SauditFileurllist = res.data.fSecondSourcefileList; //二级审核材料List
					} else {
						uni.showToast({
							title: '列表页接口报错',
							icon: 'none',
							duration: 2000
						});
						return false;
					}
				})
				.catch((error) => {
					console.log("列表页接口报错");
					return false;
				});
		},

		// 原生窗体按钮显示
		// playVideo() {
		// 	let subNVue = uni.getSubNVueById('safe_notice')
		// 	subNVue.show()
		// },
		callback() {},
		// 预览
		pdfPage(name, url) {
			let links = encodeURIComponent(url)
			uni.navigateTo({
				url: '/pages/apply/pdf?links=' + links + '&names=' + name,
			})
		},
	}
}
